package domain.user;

import junit.framework.Assert;


/**
 * @author tziff5
 *
 */
public class MemberTester extends UserTester
{

	protected static final String NAME_REGEX = ".+" ;
	protected static final String MEMBER_AS_STRING_REGEX = MemberTester.NAME_REGEX + " \\(id: " + UserTester.ID_REGEX + "\\)" ;

	/**
	 * Test method for {@link domain.user.Member#Member(long, java.lang.String, java.lang.String, util.HierarchicalSet)}.
	 * Test method for {@link domain.user.Member#Member(long, java.lang.String, java.lang.String, java.util.Set)}.
	 * @see domain.user.UserTester#testConstructors()
	 */
	@Override
	public void testConstructors()
	{
		final Member[] member =
		{
			new Member(0, "member0", "password0", super.emptyHierarchicalSet),
			new Member(0, "member1", "password1", super.fullHierarchicalSet),
			new Member(0, "member2", "password2", super.emptySet),
			new Member(0, "member3", "password3", super.singletonSet)
		} ;

		Assert.assertEquals(super.emptyHierarchicalSet, member[0].getPrivileges()) ;
		Assert.assertEquals(super.fullHierarchicalSet, member[1].getPrivileges()) ;
		Assert.assertEquals(super.emptySet, member[2].getPrivileges()) ;
		Assert.assertEquals(super.singletonSet, member[3].getPrivileges()) ;

		for (int i = 0 ; i < member.length ; i++)
		{
			Assert.assertEquals("member" + i, member[i].getUsername()) ;
			Assert.assertEquals("password" + i, member[i].getPassword()) ;
			Assert.assertEquals(false, member[i].isActive()) ;
		}
	}

	/**
	 * @see junit.framework.TestCase#setUp()
	 */
	@Override
	protected void setUp() throws Exception
	{
		super.setUp() ;
	}

	/**
	 * @see junit.framework.TestCase#tearDown()
	 */
	@Override
	protected void tearDown() throws Exception
	{
		super.tearDown() ;
	}

}
